16. Exercise: Create an AsyncTask

Create AsyncTask

Now it's your turn!

Exercise Code

Exercise: T02.05-Exercise-CreateAsyncTask

Create AsyncTask

SOLUTION:
  • Create GithubQueryTask as an inner class of MainActivity, with the types URL, Void, and String.
  • Override doInBackground to query Github and return a string
  • Override onPostExecute to set our searchResultsTextView with the GitHub query search results
  • Instantiate and call GithubQueryTask in the makeGithubSearchQuery function